package com.dgut.service.background.controller;

import com.alibaba.fastjson.JSON;
import com.dgut.service.background.config.resultConfig.JsonResult;
import com.dgut.service.background.config.resultConfig.ResultTool;
import com.dgut.service.background.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 管理员
 */
@RestController
@RequestMapping("/admin")
public class AdminController {
    @Autowired
    AdminService adminService;

    @GetMapping("/name")
    public String getAdminName(){
        String name =SecurityContextHolder.getContext().getAuthentication().getName();
        JsonResult result = ResultTool.success(name);
        return JSON.toJSONString(result);
    }


}
